﻿<UserControl x:Class="MEF_Test.Bricks.MediaBrowser.MediaBrowser"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mb="clr-namespace:MEF_Test.Bricks.MediaBrowser"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d"
             d:DesignHeight="300"
             d:DesignWidth="300">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <!--Master-->
        <ListBox ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=mb:MediaBrowser}, Path=ViewModel.Children}"
                 ItemTemplateSelector="{Binding RelativeSource={RelativeSource AncestorType=mb:MediaBrowser}, Path=ItemTemplateSelector}" 
                 mb:BrowserSelectedNodeChanged.Command="{Binding RelativeSource={RelativeSource AncestorType=mb:MediaBrowser}, Path=ViewModel.SelectedNodeChangedCommand}"
                 mb:BrowserSelectedNodeChanged.CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=SelectedItem}">
            <ListBox.ItemContainerStyle>
                <Style>
                    <EventSetter Event="Control.MouseDoubleClick"
                                 Handler="BrowserElement_DoubleClick" />
                </Style>
            </ListBox.ItemContainerStyle>
        </ListBox>
        <!--Detail-->
        <ContentPresenter Grid.Column="1"
                          Content="{Binding RelativeSource={RelativeSource AncestorType=mb:MediaBrowser}, Path=ViewModel.DetailViewModel}"
                          ContentTemplate="{Binding RelativeSource={RelativeSource AncestorType=mb:MediaBrowser}, Path=ViewModel.DetailViewModel.DetailDataTemplate}">           
        </ContentPresenter>
    </Grid>


</UserControl>
